# 赋值
x, y, z = 1, 2, 3
print(x, y, z)

#
print(f'x={x},y={y}')  # x=1,y=2
x, y = y, x
print(f'x={x},y={y}')  # x=2,y=1

# 元组解包
values = 1, 2, 3
print(values)  # (1, 2, 3)
a, b, c = values
print(a, b, c)  # 1 2 3

#
scoundrel = {'name': 'Robin', 'girlfriend': 'Marion'}
key, value = scoundrel.popitem()
print(key, value)  # girlfriend Marion

#
a, b, *rest = [1, 2, 3, 4, 5]
print(a, b, rest)  # 1 2 [3, 4, 5]

#
name = "Albus Percival Wulfric Brian Dumbledore"
first, *middle, last = name.split()
print(first, middle, last)  # Albus ['Percival', 'Wulfric', 'Brian'] Dumbledore

#
a, *b, c = 'abc'
print(a, b, c)  # a ['b'] c

# 链式赋值
x = y = 1
print(x, y)  # 1 1

x += 1
print(x)  # 2

